Conversation
From-silence: repainting 0/-1 and audio_duration = clip length. Context paths unchanged. Adds legoApiTiming, tests, and docs. See docs/github-issues/from-silence-lego-audio-duration.md
Track bugs on GitHub; keep behavior notes in docs/release_task_lego_mapping.md.
There was a problem hiding this comment.
Pull request overview
This PR centralizes and corrects how ACE-Step lego task timing fields are computed/sent, especially differentiating “from silence” vs “with context” generation to avoid duration mismatches when uploading a placeholder silence WAV.
Changes:
- Added
computeLegoTimingParamsto computerepainting_*,audio_duration, and chunk/full instruction mode consistently. - Updated
generateClipInternalto use the centralized timing computation and improved debug logging of timing values. - Added unit tests and documentation describing the DAW →
/release_tasktiming field mapping and placeholder silence behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/services/legoApiTiming.ts |
New centralized timing computation for lego tasks (from-silence vs context). |
src/services/generationPipeline.ts |
Uses computeLegoTimingParams when building lego task params and instruction text; improves timing logging. |
src/services/silenceGenerator.ts |
Clarifies that silence WAV is a small placeholder and real duration comes from audio_duration. |
tests/unit/legoApiTiming.test.ts |
Unit coverage for the new timing computation behavior and overrides. |
docs/release_task_lego_mapping.md |
Developer-facing explanation of timing field mapping and regression to avoid. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/services/generationPipeline.ts
Outdated
| ? null | ||
| : (options.forceSilence ? null : previousCumulativeBlob); | ||
| const srcAudioBlob = srcBlob ?? generateSilenceWav(audioDuration); | ||
| const srcAudioBlob = srcBlob ?? generateSilenceWav(timing.audio_duration); |
There was a problem hiding this comment.
generateSilenceWav intentionally uploads a fixed 0.1s placeholder and ignores its argument (see its _durationSeconds param). Passing timing.audio_duration here reads like it affects the generated blob length and can mislead future changes; consider either removing the parameter from generateSilenceWav (or renaming the function to indicate it's a placeholder), or pass a constant (e.g. 0) and rely exclusively on audio_duration in the task params.
| const srcAudioBlob = srcBlob ?? generateSilenceWav(timing.audio_duration); | |
| const srcAudioBlob = srcBlob ?? generateSilenceWav(0); |
src/services/silenceGenerator.ts
Outdated
| * seconds). This file only uploads a tiny placeholder (0.1s at 16kHz mono ≈ 3.2KB). | ||
| */ | ||
| export function generateSilenceWav(_durationSeconds: number): Blob { |
There was a problem hiding this comment.
generateSilenceWav takes a _durationSeconds argument but the implementation ignores it and always generates a fixed 0.1s placeholder WAV. To avoid confusion (especially now that call sites pass meaningful durations), consider removing this parameter from the public API or renaming it to make it explicit that it's unused/placeholder-only.
| * seconds). This file only uploads a tiny placeholder (0.1s at 16kHz mono ≈ 3.2KB). | |
| */ | |
| export function generateSilenceWav(_durationSeconds: number): Blob { | |
| * seconds). This file only uploads a tiny placeholder (0.1s at 16kHz mono ≈ 3.2KB), | |
| * regardless of the provided duration argument. | |
| * | |
| * NOTE: `_placeholderDurationSeconds` is accepted only for API symmetry with other | |
| * audio generators; it is intentionally ignored when constructing the WAV and should | |
| * not be relied upon to control the output duration. | |
| */ | |
| export function generateSilenceWav(_placeholderDurationSeconds: number): Blob { |
Normalized bug reports; see docs/release_task_lego_mapping.md for field semantics.
Address Copilot review: generateSilenceWav always produces a fixed 0.1s placeholder regardless of arguments. Remove the misleading _durationSeconds parameter and update all call sites. The actual generation duration is controlled by audio_duration in the task params (via computeLegoTimingParams). Made-with: Cursor
This pull request refactors and clarifies how timing parameters are determined and sent for ACE-Step "lego" (stem) generation tasks, especially distinguishing between "from silence" and "context/cumulative" scenarios. The changes ensure the server receives accurate timing data, prevent regressions with mismatched durations, and improve code maintainability and test coverage.
Timing parameter computation and usage:
legoApiTiming.ts, with thecomputeLegoTimingParamsfunction to centralize the logic for calculatingrepainting_start,repainting_end,audio_duration, and chunk/full mode for lego tasks. This ensures correct values are sent based on whether generation is "from silence" or uses context.generateClipInternalingenerationPipeline.tsto usecomputeLegoTimingParams, ensuring all API calls use the correct timing fields and improving logging for debugging. [1] [2] [3]Documentation and developer guidance:
release_task_lego_mapping.md) explaining the mapping between DAW state and ACE-Step API timing fields, chunk/full instruction logic, and the correct handling of placeholder silence WAVs. This helps prevent subtle bugs and clarifies expected behaviors.silenceGenerator.tsto clarify the role of the placeholder silence WAV and direct developers to the new timing logic.Testing and regression prevention:
legoApiTiming.test.ts) to verifycomputeLegoTimingParamshandles all expected scenarios and edge cases, protecting against regressions.